
[#include "single/layout/layout02/layout.ftl"/]
[@htmlHead]
[/@htmlHead]
[@htmlBody]
<div class="row ">
    <div class="col-xs-12">
        <ul class="nav nav-tabs">
            <li>
                <a href="${base}/resource/view/index">资源列表</a>
            </li>
            [#if "add"==operateType]
                <li class="active">
                    <a href="javascript:void(0)"> 资源增加 </a>
                </li>
            [#else]
                <li class="active">
                    <a href="javascript:void(0)"> 资源编辑 </a>
                </li>
            [/#if]
        </ul>
    </div>
</div>
<form class="form-horizontal" action="${base}/resource/view/update" method="post" id="editForm">
    <input name="id" type="hidden" value="${resource.id}">

    <div class="form-group">
        <label class="col-xs-10 col-sm-4 control-label ">上级资源</label>

        <div class="col-xs-10 col-sm-4  ">
            <input value="${parent.name}" name="resName" class="form-control input-large" disabled="disabled"/>
            <input name="parentId" type="hidden" value="${parent.id}">
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-10 col-sm-4 control-label "><span class="required">*</span>名称</label>

        <div class="col-xs-10 col-sm-4  ">
            <input name="name" value="${resource.name}" placeholder="请输入名称" class="form-control input-large"/>
        </div>
    </div>
    <div id="editAlert" class="" style="min-width:550px"></div>


    <div class="form-group">
        <label class="col-xs-10 col-sm-4 control-label ">所属应用</label>

        <div class="col-xs-10 col-sm-4  ">
            [#if parent.appKey=="BUSINESS"]
                <div class="input-group input-large">
                    <input id="appName" name="appName" value="${app.appName}" placeholder="" readonly="readonly"
                           class="form-control"/>
                         <span class="input-group-btn" onclick="component.app.choose('选择应用','appKey','appName','BOSS')">
                                <button type="button" class="btn  blue"><i class="fa fa-search"></i></button>
                            </span>
                    <input id="appKey" name="appKey" value="${app.appNameCode}" type="hidden"/>
                </div>
            [#else]
                <input value="${app.appName}" class="form-control input-large" readonly="readonly"/>
                <input value="${app.appNameCode}" name="appKey" type="hidden"/>
            [/#if]

        </div>
    </div>


    <div class="form-group">
        <label class="col-xs-10 col-sm-4 control-label "><span class="required">*</span>排序</label>

        <div class="col-xs-10 col-sm-4  ">
            <input name="sort" value="${resource.sort}" placeholder="排序" class="form-control input-large"
                   maxlength="4"/>
        </div>
    </div>

    <div class="form-group">
        <label class="col-xs-10 col-sm-4 control-label ">TARGET</label>

        <div class="col-xs-10 col-sm-4  ">
            <input name="target" value="${resource.target}" placeholder="TARGET" class="form-control input-large"/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-10 col-sm-4 control-label ">图标</label>

        <div id="choiceIcon" class="col-xs-10 col-sm-4  ">
            <button type="button" class="btn btn-info btn-sm" onclick="iconChoose('选择图标','iconId','iconText')">
                选择图标
            </button>
            <span id="iconText" class="${resource.icon}" style="padding-left: 15px;"></span>
            <input id="iconId" name="icon" value="${resource.icon}" type="hidden"/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-10 col-sm-4 control-label "><span class="required">*</span>资源类型</label>

        <div class="col-xs-10 col-sm-4  ">
            <div class="radio-list" style="padding-left:16px">
                <label class="radio-inline">
                    <input type="radio" name="type" [#if resource.type=0]checked[/#if] value="0">文件夹
                </label>
                <label class="radio-inline">
                    <input type="radio" name="type" [#if resource.type=1]checked[/#if] value="1">菜单
                </label>
                <label class="radio-inline">
                    <input type="radio" name="type" [#if resource.type=2]checked[/#if] value="2">动作
                </label>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-10 col-sm-4 control-label ">许可地址</label>

        <div class="col-xs-10 col-sm-4  ">
            <input name="permissionKey" value="${resource.permissionKey}" placeholder="请输入许可地址"
                   class="form-control input-large inline"/>
            示例：/resource/**
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-10 col-sm-4 control-label ">许可声明</label>

        <div class="col-xs-10 col-sm-4  ">
            <input name="permissionValue" value="${resource.permissionValue}" placeholder="请输入许可声明"
                   class="form-control input-large inline"/>
            示例：resource:*
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-10 col-sm-4 control-label ">跳转路径</label>

        <div class="col-xs-10 col-sm-4  ">
            <input name="url" value="${resource.url}" placeholder="跳转路径" class="form-control input-large"/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-10 col-sm-4 control-label ">资源描述</label>

        <div class="col-xs-10 col-sm-4  ">
            <textarea placeholder="描述" name="description" class="form-control input-large"
                      rows="3">${resource.description}</textarea>
        </div>
    </div>

    <div class="form-group">

        <label class="col-xs-10 col-sm-4 control-label ">是否启用</label>

        <div class="col-xs-10 col-sm-4  ">

            <div class="btn-group" role="group">
                [#if resource.isEnabled=='0']
                    <button class="btn btn-sm" type="button" value="1">启用</button>
                    <button class="btn btn-success btn-sm" type="button" value="0">禁用</button>
                    <input type="hidden" name="isEnabled" value="0"/>
                [#else]
                    <button class="btn btn-success btn-sm" type="button" value="1">启用</button>
                    <button class="btn btn-sm" type="button" value="0">禁用</button>
                    <input type="hidden" name="isEnabled" value="1"/>
                [/#if]
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class=" col-xs-10 col-sm-4  control-label"></label>
        <div class="col-xs-10 col-sm-4 " align="center">
            <input type="button" class="btn btn-info btn-sm" value="确定" onclick="doSubmit('${operateType}')"/>
            <input type="button" onclick="tools.goto('${base}/resource/view/index')" class="btn btn-cancle btn-sm" value="返回"/>
        </div>
    </div>
</form>

[/@htmlBody]
[@htmlFoot]
<!--validate-->
    [#include "common/validate.ftl"/]
<script src="${jpath}/assets/public/plugins/dialog/bootbox.js" type="text/javascript"></script>
<script src="${base}/plugins/single/js/module/resource/resource.js" type="text/javascript"></script>
<script type="text/javascript" src="${base}/plugins/single/js/module/app/app-component.js"></script>
<script src="${base}/resources/component/icon/icon.js" type="text/javascript"></script>
<script type="text/javascript">

        function iconChoose(title, idField, textField) {
            var url = base + "/resource/view/toIconList?idField=" + idField + "&textField=" + textField;
            $.messager.dialog({url: url, title: title, buttons: {}, iframe: {width: 700, height: 450}});
        }

</script>
[/@htmlFoot]